﻿namespace Agile.Service.Admin.WebApi.Controllers;

/// <summary>
/// 系统部门服务接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class SysDepartmentController : AgileControllerBase
{
    /// <summary> 添加部门 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Insert(InsertSysDepartmentRequest request)
    => Result(await this.GetService<ISysDepartmentService>().InsertAsync(request));

    /// <summary> 修改部门 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Update(UpdateSysDepartmentRequest request)
    => Result(await this.GetService<ISysDepartmentService>().UpdateAsync(request));

    /// <summary> 删除部门 </summary> 
    [HttpGet]
    public async Task<ResponseResult<bool>> Remove(long departmentID)
    => Result(await this.GetService<ISysDepartmentService>().RemoveAsync(departmentID));

    /// <summary> 查询部门 </summary> 
    [HttpPost]
    public async Task<ResponseResult<List<QuerySysDepartmentResponse>>> Query(QuerySysDepartmentRequest request)
    => Result(await this.GetService<ISysDepartmentService>().QueryAsync(request));
}
